﻿using FairyGUI;

/// <summary>
/// 滚动消息
/// </summary>
public class UIHome_GundongMsg {

	Transition _anim;
	GTextField _msg;

	public UIHome_GundongMsg(GComponent uiComp)
    {
		GComponent msgCtrl = uiComp.GetChild ("消息").asCom;
		_msg = msgCtrl.GetChild ("消息").asTextField;
		_anim = msgCtrl.GetTransition ("消息滚动");
    }

	public void SetMessage(string msg) {
		_msg.text = msg;
	}

	public void StartScroll() {
		_anim.autoPlay = true;
		_anim.autoPlayRepeat = -1;
		_anim.Play ();
	}

	public void StopScroll() {
		if (_anim.playing) {
			_anim.Stop ();
		}
	}
}
